Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

klaw

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

klaw

File system walker with Readable stream interface.

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.8M
increased by3.75%
Maintainers
3
Weekly downloads
 
Created

What is klaw?

The 'klaw' npm package is a file system walker that allows you to recursively traverse directories and perform actions on files and directories. It is useful for tasks such as file searching, filtering, and processing.

What are klaw's main functionalities?

Recursively Traverse Directories

This feature allows you to recursively traverse directories starting from a specified path. The code sample demonstrates how to use 'klaw' to log the path of each file and directory it encounters.

const klaw = require('klaw');
const path = require('path');

klaw('/some/dir')
  .on('data', item => console.log(item.path))
  .on('end', () => console.log('All done!'));

Filter Files and Directories

This feature allows you to filter files and directories based on a custom function. The code sample demonstrates how to use 'klaw' to only log the paths of JavaScript files.

const klaw = require('klaw');
const path = require('path');

const filterFunc = item => path.extname(item) === '.js';

klaw('/some/dir', { filter: filterFunc })
  .on('data', item => console.log(item.path))
  .on('end', () => console.log('All done!'));

Handle Errors

This feature allows you to handle errors that occur during the directory traversal. The code sample demonstrates how to use 'klaw' to log errors to the console.

const klaw = require('klaw');
const path = require('path');

klaw('/some/dir')
  .on('data', item => console.log(item.path))
  .on('error', err => console.error('Error:', err))
  .on('end', () => console.log('All done!'));

Other packages similar to klaw

Keywords

FAQs

Package last updated on 18 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc